//
//  YFPlayerVC.m
//  project
//
//  Created by yefei on 2019/4/18.
//  Copyright © 2019 健健. All rights reserved.
//

#import "YFPlayerVC.h"
#import "YFPlayerCell.h"
#import "YFJourneyModel.h"
#import "YFPlayerDataSourceModel.h"
#import "PairView.h"
#import "AVPlayerManager.h"
#import "HJDataHomeEmptyView.h"
//#import "ZFPlayer.h"
#import "YFJourneyModel.h"
#import "YFPublishTripVC.h"
#import "HJAlertView.h"
#import "YFPublishTripVC.h"
#import "HJUpdateVC.h"
#import <WXApi.h>

static NSString * yf_PlayerCell = @"YFPlayerCell";

@interface YFPlayerVC () <UITableViewDataSource, UITableViewDelegate,UIScrollViewDelegate,pairViewDelegate,DataHomeEmptyViewDelegate>
@property (weak, nonatomic) IBOutlet UIButton *backNavigaitonButton;
@property (weak, nonatomic) IBOutlet UIButton *moreButton;
@property (nonatomic, strong) NSMutableArray<YFPlayerDataSourceModel *> *userInfoArray;
@property (nonatomic, assign) NSInteger currentIndex;
@property (nonatomic, assign) BOOL isCurPlayerPause;
@property (nonatomic,strong) id myTrip;
@property (nonatomic,strong) PairView * pairView;
@property (nonatomic,strong) HJDataHomeEmptyView * emptyView;
//分享蒙版
@property (nonatomic, strong) UIView *shareView;
/**
 检查版本跟新
 */
@property (nonatomic,strong) HJUpdateVC * updateVC;
@end

@implementation YFPlayerVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self loadUpdateCheckVersion];
//    [self loadData];
    [self loadNetworkData];
    [self configRefresh];
    //self.shareView.hidden = NO;
    [mNotificationCenter addObserver:self selector:@selector(statusBarTouchBegin) name:@"StatusBarTouchBeginNotification" object:nil];
    [mNotificationCenter addObserver:self selector:@selector(applicationBecomeActive) name:UIApplicationWillEnterForegroundNotification object:nil];
    [mNotificationCenter addObserver:self selector:@selector(applicationEnterBackground) name: UIApplicationDidEnterBackgroundNotification object:nil];
    [self addObserver:self forKeyPath:@"currentIndex" options:NSKeyValueObservingOptionInitial|NSKeyValueObservingOptionNew context:nil];
}

-(void)configTableView {
    self.tableViewStyle = UITableViewStylePlain;
    [super configTableView];
    
    HJDataHomeEmptyView * emptyView = [[HJDataHomeEmptyView alloc]init];
    emptyView.delegate = self;
    self.emptyView = emptyView;
    self.tableView.emptyView = emptyView;
    self.tableView.estimatedRowHeight = 0;
    self.tableView.estimatedSectionFooterHeight = 0;
    self.tableView.estimatedSectionHeaderHeight = 0;
    self.tableView.pagingEnabled = YES;
    self.tableView.backgroundColor = [UIColor blackColor];

}
-(void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
//    self.tableView.frame = CGRectMake(0, Height_StatusBar, SCREEN_WIDTH, SCREEN_HEIGTH-Height_TabBar-Height_StatusBar);
    self.tableView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH-Height_TabBar);
    self.emptyView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH);
}

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES];
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    [self applicationBecomeActive];
}
-(void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [self.navigationController setNavigationBarHidden:NO];
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
    [self applicationEnterBackground];
}
#pragma mark - 刷新
- (void)configRefresh {
    @weakify(self)
    MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
        @strongify(self)
        [self.userInfoArray removeAllObjects];
        [self loadNetworkData];
    }];
    self.tableView.mj_header = header;
    MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:^{
        @strongify(self)
        [self loadNetworkData];
    }];
    self.tableView.mj_footer = footer;
}

#pragma mark - 弹起更新弹窗
-(HJUpdateVC *)updateVC {
    if (!_updateVC) {
        _updateVC = [[HJUpdateVC alloc]init];
        _updateVC.view.frame = CGRectMake(0, SCREEN_HEIGTH, SCREEN_WIDTH, SCREEN_HEIGTH);
        [[UIApplication sharedApplication].keyWindow addSubview:_updateVC.view];
    }
    return _updateVC;
}

-(void)loadUpdateCheckVersion {
    WS(weakSelf)
    NSString * url = [Api stringByAppendingString:checkVersionApi];
    [HJHttpTool post:url params:@{@"deviceType":@"iphone"} success:^(HJResponeds *result) {
        if (![result.data isEqual:[NSNull null]] && [result.data[@"status"] integerValue] == 1 ) {
            [weakSelf.updateVC updateLoadDataWithDic:result.data];
            dispatch_async(dispatch_get_main_queue(), ^{
                [UIView animateWithDuration:0.5 animations:^{
                    weakSelf.updateVC.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH);
                } completion:^(BOOL finished) {
                   // weakSelf.updateVC = nil;
                }];
            });
        }
    } failure:^(id result) {
        
        LKLog(@"%@", result);
    }];
}

//- (void)loadData {
//    [self.tableView.mj_header beginRefreshing];
   // [self.tableView.mj_footer beginRefreshing];
//}

#pragma mark - UITableViewDataSource, UITableViewDelegate
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.userInfoArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    YFPlayerCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    if (!cell) {
        cell = [[NSBundle mainBundle]loadNibNamed:yf_PlayerCell owner:nil options:nil].firstObject;
    }
    cell.tripId = self.tripId;
//    LKLog(@"tripid = %@", self.tripId);
    cell.index = indexPath;
    if (self.userInfoArray && self.userInfoArray.count > 0) {
        cell.model = self.userInfoArray[indexPath.row];
    }
    cell.likeBtnClickedBlock = ^(UIImage * _Nonnull image, YFPlayerDataSourceModel * _Nonnull model, UIButton * _Nonnull btn) {
        if ([self.myTrip isEqual:[NSNull null]]) {
            HJAlertView * alertView = [HJAlertView alert];
            [alertView show];
            alertView.block = ^{
                YFPublishTripVC * publicVC = [YFPublishTripVC new];
                [self.navigationController pushViewController:publicVC animated:YES];
            };
            return;
        }
        NSString * likeUrl = [Api stringByAppendingString:LikeTripApi];
        NSMutableDictionary * parms = [NSMutableDictionary dictionary];
        parms[@"createTime"] = model.trip.createTime;
        parms[@"likeTripId"] = model.trip.journey_id;
        
        if (!self.tripId.length) {
            return;
        }
        
        parms[@"tripId"]= self.tripId;
        parms[@"userId"] = [HJUserManager getUserModel].userId;
        parms[@"likeUserId"] = model.user.userId;
        WS(weakSelf)
        [HJHttpTool post:likeUrl params:parms success:^(HJResponeds *result) {
            model.like_status = @"1";
            [self.userInfoArray replaceObjectAtIndex:indexPath.row withObject:model];
            dispatch_async(dispatch_get_main_queue(), ^{
                btn.transform = CGAffineTransformMakeScale(0, 0);
                [UIView animateWithDuration:0.25 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:1 options:(UIViewAnimationOptionCurveEaseOut) animations:^{
                    btn.transform = CGAffineTransformMakeScale(1.7, 1.7);
                    btn.transform = CGAffineTransformMakeScale(1, 1);
                    btn.selected = !btn.selected;
                    btn.userInteractionEnabled = !btn.selected;
                } completion:^(BOOL finished) {
                    btn.transform = CGAffineTransformIdentity;
                }];
                if (![result.data[@"likeStatus"] boolValue]) return;
                [weakSelf animationPairViewWithImage:image];
                [weakSelf.pairView loadDataModel:result.data tripUerModel:weakSelf.userInfoArray[indexPath.row]];
            });
        } failure:^(id result) {
            [weakSelf showErrorHUDWithError:result];
        }];
    };
    WS(weakSelf);
    cell.shareBtnClickedBlock = ^(YFPlayerDataSourceModel * _Nonnull model, UIButton * _Nonnull btn) {
        //分享btn点击
        //[UIView animateWithDuration:0.25 animations:^{
            weakSelf.shareView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH);
        //}];
    };
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
//    return SCREEN_HEIGTH-Height_TabBar-(Height_StatusBar);
    return SCREEN_HEIGTH-Height_TabBar;
}
#pragma mark - UIScrollViewDelegate  列表播放必须实现

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
    dispatch_async(dispatch_get_main_queue(), ^{
        CGPoint translatedPoint = [scrollView.panGestureRecognizer translationInView:scrollView];
        //UITableView禁止响应其他滑动手势
        scrollView.panGestureRecognizer.enabled = NO;
        if (translatedPoint.y < -50 && self.currentIndex < (self.userInfoArray.count - 1)) {
            self.currentIndex ++;   //向下滑动索引递增
        }
        if(translatedPoint.y > 50 && self.currentIndex > 0) {
            self.currentIndex --;   //向上滑动索引递减
        }
        if (self.userInfoArray.count==0) return;
        [UIView animateWithDuration:0.15 delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{
            [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:self.currentIndex inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:NO];
        } completion:^(BOOL finished) {
            //UITableView可以响应其他滑动手势
            scrollView.panGestureRecognizer.enabled = YES;
        }];
    });
}

#pragma mark - Lazy Load
- (NSMutableArray<YFPlayerDataSourceModel *> *)userInfoArray {
    if (!_userInfoArray) {
        _userInfoArray = [NSMutableArray array];
    }
    return _userInfoArray;
}

#pragma mark - 网络请求
-(void)loadNetworkData {
    NSString * postString = [Api stringByAppendingString:MatchApi];
    NSMutableDictionary * params = [NSMutableDictionary dictionary];
    //params[@"pageCurrent"] = @(self.page);
    params[@"tripId"] = self.tripId;
    __weak typeof(self) weakSelf = self;
    [HJHttpTool get:postString params:params success:^(HJResponeds *result) {
        LKLog(@"%@",result.data);
        __strong typeof(weakSelf) strongSelf = weakSelf;
        if ([result.data isEqual:[NSNull null]]) {
            return;
        }
        self.myTrip = result.data[@"myTrip"];
        if (!self.tripId.length) {
            if ([self.myTrip isKindOfClass:[NSDictionary class]]) {
                self.tripId = [NSString stringWithFormat:@"%@", self.myTrip[@"id"]];
            }
        }
        NSArray * arr = [NSArray yy_modelArrayWithClass:[YFPlayerDataSourceModel class] json:result.data[@"list"][@"records"]];
<<<<<<< HEAD
=======

        [strongSelf.userInfoArray  addObjectsFromArray: arr];

>>>>>>> refs/remotes/origin/master
        if (!arr.count) {
            [weakSelf.tableView.mj_footer endRefreshingWithNoMoreData];
        }
        [strongSelf.userInfoArray  addObjectsFromArray: arr];
        [weakSelf.tableView endRefresh];
        [weakSelf.tableView reloadData];
    } failure:^(id result) {
        [weakSelf.tableView endRefresh];
        [weakSelf.tableView reloadData];
    }];
}

-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context{
    if ([keyPath isEqualToString:@"currentIndex"]) {
        //设置用于标记当前视频是否播放的BOOL值为NO
        _isCurPlayerPause = NO;
        //获取当前显示的cell
        YFPlayerCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:_currentIndex inSection:0]];
        __weak typeof (cell) wcell = cell;
        __weak typeof (self) wself = self;
        //判断当前cell的视频源是否已经准备播放
        if(cell.isPlayerReady) {
            //播放视频
            [cell replay];
        }else {
            [[AVPlayerManager shareManager] pauseAll];
            //当前cell的视频源还未准备好播放，则实现cell的OnPlayerReady Block 用于等待视频准备好后通知播放
            cell.OnPlayerReady = ^{
                NSIndexPath *indexPath = [wself.tableView indexPathForCell:wcell];
                if(!wself.isCurPlayerPause && indexPath && indexPath.row == wself.currentIndex) {
                    [wcell play];
                }
            };
        }
    }else {
        return [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
    }
}
- (void)statusBarTouchBegin {
    _currentIndex = 0;
}

- (void)applicationBecomeActive {
    YFPlayerCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.currentIndex inSection:0]];
//    if (self.userInfoArray && self.userInfoArray.count > 0 && self.userInfoArray.count > self.currentIndex) {
//        cell.model = self.userInfoArray[self.currentIndex];
//    }
    if(!_isCurPlayerPause) {
        [cell play];
    }
}

- (void)applicationEnterBackground {
    YFPlayerCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:_currentIndex inSection:0]];
    _isCurPlayerPause = ![cell rate];
    [cell pause];
}


#pragma mark -- DataHomeEmptyViewDelegate
-(void)publicButtonClicked {
    YFPublishTripVC * publishVc =[YFPublishTripVC new];
    [self.navigationController pushViewController:publishVc animated:YES];
}


#pragma mark -- pairView创建
-(PairView *)pairView {
    if (!_pairView) {
        _pairView = [[PairView alloc]init];
        _pairView.frame = CGRectMake(0, SCREEN_HEIGTH, SCREEN_WIDTH, SCREEN_HEIGTH);
        _pairView.delegate = self;
        _pairView.backgroundColor = [UIColor clearColor];
        [[UIApplication sharedApplication].keyWindow addSubview:_pairView];
    }
    return _pairView;
}
#pragma mark -- pairView代理关闭
-(void)animationPairViewWithImage:(UIImage *)image {
    self.pairView.beijing.image = image;
    // 模糊效果
    UIVisualEffectView *ruVisualEffectView = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]];
    ruVisualEffectView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH);
    ruVisualEffectView.alpha = 0.6;
    [self.pairView.beijing addSubview:ruVisualEffectView];
    WS(weakSelf)
    [UIView animateWithDuration:0.5 animations:^{
        weakSelf.pairView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH);
    }];
}
-(void)cancelView {
    WS(weakSelf)
    [UIView animateWithDuration:.5 animations:^{
        weakSelf.pairView.frame = CGRectMake(0, SCREEN_HEIGTH, SCREEN_WIDTH, SCREEN_HEIGTH);
    } completion:^(BOOL finished) {
        [weakSelf.pairView removeFromSuperview];
        weakSelf.pairView = nil;
    }];
}

#pragma mark -- shareView
- (UIView *)shareView {
    if (!_shareView) {
        _shareView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGTH, SCREEN_WIDTH, SCREEN_HEIGTH)];
        
        //_shareView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH);
        UIVisualEffectView *ruVisualEffectView = [[UIVisualEffectView alloc]initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]];
        ruVisualEffectView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGTH);
        ruVisualEffectView.alpha = 0.3;
        [_shareView addSubview:ruVisualEffectView];
        
        UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGTH - 160, SCREEN_WIDTH, 170)];
        contentView.backgroundColor = [UIColor colorWithHexString:@"1a1a1a"];
        
        [contentView rounded:(UIRectCornerAllCorners) radius:10];
        
        //[contentView rounded:(UIRectCornerTopRight) radius:10];
        [_shareView addSubview:contentView];
        
        UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(80, 20, SCREEN_WIDTH - 160, 20)];
        titleLabel.textColor = [UIColor whiteColor];
        titleLabel.textAlignment = NSTextAlignmentCenter;
        titleLabel.font = [UIFont systemFontOfSize:17];
        titleLabel.text = @"分享到";
        [contentView addSubview:titleLabel];
        
        UIButton *cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 30, 20, 20, 20)];
        WS(weakSelf);
        [[cancelBtn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
            
            [weakSelf hideShareView];
        }];
        [cancelBtn setImage:[UIImage imageNamed:@"guanbi"] forState:UIControlStateNormal];
        [contentView addSubview:cancelBtn];
        
        UIButton *wchatBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 40 - 48, CGRectGetMaxY(titleLabel.frame) + 20, 48, 48)];
        [wchatBtn setImage:[UIImage imageNamed:@"haoyou"] forState:UIControlStateNormal];
        [wchatBtn addTarget:self action:@selector(shareToFriend) forControlEvents:UIControlEventTouchUpInside];
        [contentView addSubview:wchatBtn];
        
        UILabel *friendLabel = [[UILabel alloc] init];
        [contentView addSubview:friendLabel];
        [friendLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(wchatBtn.mas_centerX);
            make.top.equalTo(wchatBtn.mas_bottom).with.offset(10);
            make.width.mas_equalTo(90);
            make.height.mas_equalTo(20);
        }];
        friendLabel.text = @"微信好友";
        friendLabel.textAlignment = NSTextAlignmentCenter;
        friendLabel.font = [UIFont systemFontOfSize:14];
        friendLabel.textColor = [UIColor whiteColor];
        
        UIButton *circleBtn = [[UIButton alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 + 40, CGRectGetMinY(wchatBtn.frame), 48, 48)];
        [circleBtn setImage:[UIImage imageNamed:@"quanzi"] forState:UIControlStateNormal];
        [circleBtn addTarget:self action:@selector(shareToCircle) forControlEvents:UIControlEventTouchUpInside];

        [contentView addSubview:circleBtn];
        
        UILabel *circleLabel = [[UILabel alloc] init];
        [contentView addSubview:circleLabel];
        [circleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(circleBtn);
            make.top.equalTo(friendLabel);
            make.width.mas_equalTo(90);
            make.height.mas_equalTo(20);
        }];
        circleLabel.text = @"朋友圈";
        circleLabel.textColor = [UIColor whiteColor];
        circleLabel.textAlignment = NSTextAlignmentCenter;
        circleLabel.font = [UIFont systemFontOfSize:14];
        
        [[UIApplication sharedApplication].keyWindow addSubview:_shareView];
        
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
        [[tap rac_gestureSignal] subscribeNext:^(__kindof UIGestureRecognizer * _Nullable x) {
            [weakSelf hideShareView];
        }];
        _shareView.userInteractionEnabled = YES;
        [_shareView addGestureRecognizer:tap];
        
    }
    return _shareView;
}
- (void)shareToFriend {
    YFPlayerCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.currentIndex inSection:0]];
    NSString *dynUrl;
    if (cell.model.isVideo) {
        dynUrl = [NSString stringWithFormat:@" http://www.lejianyou.com/share.html?fileType=video&fileUrl=%@", cell.model.videoSource.url];
    } else {
        if (cell.model.imagesSource.count > 0) {
            dynUrl = [NSString stringWithFormat:@" http://www.lejianyou.com/share.html?fileType=image&fileUrl=%@", cell.model.imagesSource[0]];
        }
        
    }
    WXMediaMessage *message = [WXMediaMessage message];
    message.title = @"这是什么神仙社区啊";//标题
    message.description = @"好多漂亮小哥哥小姐姐";//描述
    [message setThumbImage:[UIImage imageNamed:@"logo_lejian"]];//设置预览图
    
    //创建网页数据对象
    WXWebpageObject *webObj = [WXWebpageObject object];
    webObj.webpageUrl = dynUrl;
    message.mediaObject = webObj;
    
    SendMessageToWXReq *sendReq = [[SendMessageToWXReq alloc] init];
    sendReq.bText = NO;//不使用文本信息
    sendReq.message = message;
    sendReq.scene = WXSceneSession;//分享到朋友圈
    [WXApi sendReq:sendReq];//发送对象实例
    
    [self hideShareView];
}
- (void)shareToCircle {
    YFPlayerCell *cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.currentIndex inSection:0]];
    NSString *dynUrl;
    if (cell.model.isVideo) {
        dynUrl = [NSString stringWithFormat:@" http://www.lejianyou.com/share.html?fileType=video&fileUrl=%@", cell.model.videoSource.url];
    } else {
        if (cell.model.imagesSource.count > 0) {
            dynUrl = [NSString stringWithFormat:@" http://www.lejianyou.com/share.html?fileType=image&fileUrl=%@", cell.model.imagesSource[0]];
        }
        
    }
    WXMediaMessage *message = [WXMediaMessage message];
    message.title = @"这是什么神仙社区啊";//标题
    message.description = @"好多漂亮小哥哥小姐姐";//描述
   [message setThumbImage:[UIImage imageNamed:@"logo_lejian"]];//设置预览图
    
    //创建网页数据对象
    WXWebpageObject *webObj = [WXWebpageObject object];
    webObj.webpageUrl = dynUrl;
    message.mediaObject = webObj;
    
    SendMessageToWXReq *sendReq = [[SendMessageToWXReq alloc] init];
    sendReq.bText = NO;//不使用文本信息
    sendReq.message = message;
    sendReq.scene = WXSceneTimeline;//分享到朋友圈
    [WXApi sendReq:sendReq];//发送对象实例

    [self hideShareView];
}
- (void)hideShareView {
    [UIView animateWithDuration:.5 animations:^{
        self.shareView.frame = CGRectMake(0, SCREEN_HEIGTH, SCREEN_WIDTH, SCREEN_HEIGTH);
    } completion:^(BOOL finished) {
        [self.shareView removeFromSuperview];
        self.shareView = nil;
    }];
}
@end
